home *** CD-ROM | disk | FTP | other *** search
/ Freelog 121 / FreelogMagazineJuilletAout2014-No121.iso / Outils / Adobe-Air / adobe-air_13.exe / [0] / setup.swf / scripts / mx / skins / halo / ScrollArrowSkin.as < prev    next >
Text File  |  2014-03-27  |  10KB  |  234 lines

  1. package mx.skins.halo
  2. {
  3.    import flash.display.GradientType;
  4.    import flash.display.Graphics;
  5.    import flash.geom.Matrix;
  6.    import mx.controls.scrollClasses.ScrollBar;
  7.    import mx.core.FlexVersion;
  8.    import mx.core.mx_internal;
  9.    import mx.skins.Border;
  10.    import mx.styles.StyleManager;
  11.    import mx.utils.ColorUtil;
  12.    
  13.    use namespace mx_internal;
  14.    
  15.    public class ScrollArrowSkin extends Border
  16.    {
  17.       
  18.       mx_internal static const VERSION:String = "3.0.0.0";
  19.       
  20.       private static var cache:Object = {};
  21.        
  22.       
  23.       public function ScrollArrowSkin()
  24.       {
  25.          super();
  26.       }
  27.       
  28.       private static function calcDerivedStyles(param1:uint, param2:uint, param3:uint, param4:uint) : Object
  29.       {
  30.          var _loc6_:Object = null;
  31.          var _loc5_:String = HaloColors.getCacheKey(param1,param2,param3,param4);
  32.          if(!cache[_loc5_])
  33.          {
  34.             _loc6_ = cache[_loc5_] = {};
  35.             HaloColors.addHaloColors(_loc6_,param1,param3,param4);
  36.             _loc6_.borderColorDrk1 = ColorUtil.adjustBrightness2(param2,-25);
  37.             _loc6_.borderColorDrk2 = ColorUtil.adjustBrightness2(param2,-50);
  38.          }
  39.          return cache[_loc5_];
  40.       }
  41.       
  42.       override public function get measuredWidth() : Number
  43.       {
  44.          return ScrollBar.THICKNESS;
  45.       }
  46.       
  47.       override public function get measuredHeight() : Number
  48.       {
  49.          return ScrollBar.THICKNESS;
  50.       }
  51.       
  52.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  53.       {
  54.          var _loc13_:Array = null;
  55.          var _loc15_:Array = null;
  56.          var _loc16_:Array = null;
  57.          var _loc17_:Array = null;
  58.          var _loc18_:Array = null;
  59.          var _loc19_:Array = null;
  60.          var _loc20_:Array = null;
  61.          super.updateDisplayList(param1,param2);
  62.          var _loc3_:Number = getStyle("backgroundColor");
  63.          var _loc4_:uint = getStyle("borderColor");
  64.          var _loc5_:Array = getStyle("fillAlphas");
  65.          var _loc6_:Array = getStyle("fillColors");
  66.          StyleManager.getColorNames(_loc6_);
  67.          var _loc7_:Array = getStyle("highlightAlphas");
  68.          var _loc8_:uint = getStyle("themeColor");
  69.          var _loc9_:* = name.charAt(0) == "u";
  70.          var _loc10_:uint = getStyle("iconColor");
  71.          var _loc11_:Object = calcDerivedStyles(_loc8_,_loc4_,_loc6_[0],_loc6_[1]);
  72.          var _loc12_:Boolean = parent && parent.parent && parent.parent.rotation != 0;
  73.          if(_loc9_ && !_loc12_)
  74.          {
  75.             _loc13_ = [_loc4_,_loc11_.borderColorDrk1];
  76.          }
  77.          else
  78.          {
  79.             _loc13_ = [_loc11_.borderColorDrk1,_loc11_.borderColorDrk2];
  80.          }
  81.          var _loc14_:Graphics;
  82.          (_loc14_ = graphics).clear();
  83.          if(isNaN(_loc3_))
  84.          {
  85.             _loc3_ = 16777215;
  86.          }
  87.          if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0 || name.indexOf("Disabled") == -1)
  88.          {
  89.             drawRoundRect(0,0,param1,param2,0,_loc3_,1);
  90.          }
  91.          switch(name)
  92.          {
  93.             case "upArrowUpSkin":
  94.                if(!_loc12_)
  95.                {
  96.                   drawRoundRect(1,param2 - 4,param1 - 2,8,0,[_loc11_.borderColorDrk1,_loc11_.borderColorDrk1],[1,0],verticalGradientMatrix(1,param2 - 4,param1 - 2,8),GradientType.LINEAR,null,{
  97.                      "x":1,
  98.                      "y":param2 - 4,
  99.                      "w":param1 - 2,
  100.                      "h":4,
  101.                      "r":0
  102.                   });
  103.                }
  104.             case "downArrowUpSkin":
  105.                _loc15_ = [_loc6_[0],_loc6_[1]];
  106.                _loc16_ = [_loc5_[0],_loc5_[1]];
  107.                drawRoundRect(0,0,param1,param2,0,_loc13_,1,!!_loc12_ ? horizontalGradientMatrix(0,0,param1,param2) : verticalGradientMatrix(0,0,param1,param2),GradientType.LINEAR,null,{
  108.                   "x":1,
  109.                   "y":1,
  110.                   "w":param1 - 2,
  111.                   "h":param2 - 2,
  112.                   "r":0
  113.                });
  114.                drawRoundRect(1,1,param1 - 2,param2 - 2,0,_loc15_,_loc16_,!!_loc12_ ? horizontalGradientMatrix(0,0,param1 - 2,param2 - 2) : verticalGradientMatrix(0,0,param1 - 2,param2 - 2 / 2));
  115.                drawRoundRect(1,1,param1 - 2,param2 - 2 / 2,0,[16777215,16777215],_loc7_,!!_loc12_ ? horizontalGradientMatrix(0,0,param1 - 2,param2 - 2) : verticalGradientMatrix(0,0,param1 - 2,param2 - 2 / 2));
  116.                break;
  117.             case "upArrowOverSkin":
  118.                if(!_loc12_)
  119.                {
  120.                   drawRoundRect(1,param2 - 4,param1 - 2,8,0,[_loc11_.borderColorDrk1,_loc11_.borderColorDrk1],[1,0],verticalGradientMatrix(1,param2 - 4,param1 - 2,8),GradientType.LINEAR,null,{
  121.                      "x":1,
  122.                      "y":param2 - 4,
  123.                      "w":param1 - 2,
  124.                      "h":4,
  125.                      "r":0
  126.                   });
  127.                }
  128.             case "downArrowOverSkin":
  129.                if(_loc6_.length > 2)
  130.                {
  131.                   _loc17_ = [_loc6_[2],_loc6_[3]];
  132.                }
  133.                else
  134.                {
  135.                   _loc17_ = [_loc6_[0],_loc6_[1]];
  136.                }
  137.                if(_loc5_.length > 2)
  138.                {
  139.                   _loc18_ = [_loc5_[2],_loc5_[3]];
  140.                }
  141.                else
  142.                {
  143.                   _loc18_ = [_loc5_[0],_loc5_[1]];
  144.                }
  145.                drawRoundRect(0,0,param1,param2,0,16777215,1);
  146.                drawRoundRect(0,0,param1,param2,0,[_loc8_,_loc11_.themeColDrk1],1,!!_loc12_ ? horizontalGradientMatrix(0,0,param1,param2) : verticalGradientMatrix(0,0,param1,param2),GradientType.LINEAR,null,{
  147.                   "x":1,
  148.                   "y":1,
  149.                   "w":param1 - 2,
  150.                   "h":param2 - 2,
  151.                   "r":0
  152.                });
  153.                drawRoundRect(1,1,param1 - 2,param2 - 2,0,_loc17_,_loc18_,!!_loc12_ ? horizontalGradientMatrix(0,0,param1 - 2,param2 - 2) : verticalGradientMatrix(0,0,param1 - 2,param2 - 2));
  154.                drawRoundRect(1,1,param1 - 2,param2 - 2 / 2,0,[16777215,16777215],_loc7_,!!_loc12_ ? horizontalGradientMatrix(0,0,param1 - 2,param2 - 2) : verticalGradientMatrix(0,0,param1 - 2,param2 - 2 / 2));
  155.                break;
  156.             case "upArrowDownSkin":
  157.                if(!_loc12_)
  158.                {
  159.                   drawRoundRect(1,param2 - 4,param1 - 2,8,0,[_loc11_.borderColorDrk1,_loc11_.borderColorDrk1],[1,0],!!_loc12_ ? horizontalGradientMatrix(1,param2 - 4,param1 - 2,8) : verticalGradientMatrix(1,param2 - 4,param1 - 2,8),GradientType.LINEAR,null,{
  160.                      "x":1,
  161.                      "y":param2 - 4,
  162.                      "w":param1 - 2,
  163.                      "h":4,
  164.                      "r":0
  165.                   });
  166.                }
  167.             case "downArrowDownSkin":
  168.                drawRoundRect(0,0,param1,param2,0,[_loc8_,_loc11_.themeColDrk1],1,!!_loc12_ ? horizontalGradientMatrix(0,0,param1,param2) : verticalGradientMatrix(0,0,param1,param2),GradientType.LINEAR,null,{
  169.                   "x":1,
  170.                   "y":1,
  171.                   "w":param1 - 2,
  172.                   "h":param2 - 2,
  173.                   "r":0
  174.                });
  175.                drawRoundRect(1,1,param1 - 2,param2 - 2,0,[_loc11_.fillColorPress1,_loc11_.fillColorPress2],1,!!_loc12_ ? horizontalGradientMatrix(0,0,param1 - 2,param2 - 2) : verticalGradientMatrix(0,0,param1 - 2,param2 - 2));
  176.                drawRoundRect(1,1,param1 - 2,param2 - 2 / 2,0,[16777215,16777215],_loc7_,!!_loc12_ ? horizontalGradientMatrix(0,0,param1 - 2,param2 - 2) : verticalGradientMatrix(0,0,param1 - 2,param2 - 2 / 2));
  177.                break;
  178.             case "upArrowDisabledSkin":
  179.                if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  180.                {
  181.                   if(!_loc12_)
  182.                   {
  183.                      drawRoundRect(1,param2 - 4,param1 - 2,8,0,[_loc11_.borderColorDrk1,_loc11_.borderColorDrk1],[0.5,0],verticalGradientMatrix(1,param2 - 4,param1 - 2,8),GradientType.LINEAR,null,{
  184.                         "x":1,
  185.                         "y":param2 - 4,
  186.                         "w":param1 - 2,
  187.                         "h":4,
  188.                         "r":0
  189.                      });
  190.                   }
  191.                }
  192.             case "downArrowDisabledSkin":
  193.                if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  194.                {
  195.                   _loc19_ = [_loc6_[0],_loc6_[1]];
  196.                   _loc20_ = [_loc5_[0] - 0.15,_loc5_[1] - 0.15];
  197.                   drawRoundRect(0,0,param1,param2,0,_loc13_,0.5,!!_loc12_ ? horizontalGradientMatrix(0,0,param1,param2) : verticalGradientMatrix(0,0,param1,param2),GradientType.LINEAR,null,{
  198.                      "x":1,
  199.                      "y":1,
  200.                      "w":param1 - 2,
  201.                      "h":param2 - 2,
  202.                      "r":0
  203.                   });
  204.                   drawRoundRect(1,1,param1 - 2,param2 - 2,0,_loc19_,_loc20_,!!_loc12_ ? horizontalGradientMatrix(0,0,param1 - 2,param2 - 2) : verticalGradientMatrix(0,0,param1 - 2,param2 - 2 / 2));
  205.                   _loc10_ = getStyle("disabledIconColor");
  206.                   break;
  207.                }
  208.                drawRoundRect(0,0,param1,param2,0,16777215,0);
  209.                return;
  210.                break;
  211.             default:
  212.                drawRoundRect(0,0,param1,param2,0,16777215,0);
  213.                return;
  214.          }
  215.          _loc14_.beginFill(_loc10_);
  216.          if(_loc9_)
  217.          {
  218.             _loc14_.moveTo(param1 / 2,6);
  219.             _loc14_.lineTo(param1 - 5,param2 - 6);
  220.             _loc14_.lineTo(5,param2 - 6);
  221.             _loc14_.lineTo(param1 / 2,6);
  222.          }
  223.          else
  224.          {
  225.             _loc14_.moveTo(param1 / 2,param2 - 6);
  226.             _loc14_.lineTo(param1 - 5,6);
  227.             _loc14_.lineTo(5,6);
  228.             _loc14_.lineTo(param1 / 2,param2 - 6);
  229.          }
  230.          _loc14_.endFill();
  231.       }
  232.    }
  233. }
  234.